#include "gamelayerui.h"
#include "HelloWorldScene.h"
#include "aninode.h"
USING_NS_CC_EXT;
USING_NS_CC;

GameLayerUI::GameLayerUI()
{

}

GameLayerUI::~GameLayerUI()
{

	GUIReader::purgeGUIReader();
	DictionaryHelper::purgeDictionaryHelper();
	ActionManager::purgeActionManager();
}
void GameLayerUI::EntermainButton(CCObject* pSender)
{
	cur_actId = (cur_actId+1)%5;
	HelloWorld::shareHelloWord()->getHero()->setActid(cur_actId,false);
	enterUIButton->setText(actIdname[cur_actId]);
}

bool GameLayerUI::init()
{
	if (UILayer::init())
	{
		addWidget(GUIReader::shareReader()->widgetFromJsonFile("uiExport/demo_1.json"));
		{
			enterUIButton = dynamic_cast<UITextButton*>(getWidgetByName("TextButton_23")); 
			enterUIButton->addReleaseEvent(this,coco_releaseselector(GameLayerUI::EntermainButton));
		}
		return true;
	}
	else
		return false;
}